package m.base.model;

import m.common.model.FieldMeta;
import m.common.model.LinkTableMeta;
import m.common.model.MigrationModel;
import m.common.model.TableMeta;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import manage.model.OrgGroupView;

import java.util.Collections;
import java.util.Date;
import java.util.List;

@TableMeta(name = "os_admin_group", description = "商户信息|继承管理员组")
public class StoreInfo extends OrgGroupView implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return Collections.singletonList(storeOid);
    }

    @LinkTableMeta(name="level_oid",table= LevelInfo.class,description="级别信息")
    private LevelInfo level;
    @FieldMeta(name="level_end_date",type= FieldType.DATE,description="级别结束时间")
    private Date levelEndDate;
    @FieldMeta(name="tel",type= FieldType.STRING,length=20,description="联系电话")
    private String tel;
    @FieldMeta(name="address",type= FieldType.STRING,length=300,description="地址")
    private String address;
    @FieldMeta(name="create_user_oid",type= FieldType.STRING,length=50,description="创建用户主键")
    private String createUserOid;

    @FieldMeta(name="repository_check",type= FieldType.STRING,length=10,defaultValue = "N",description="仓库审核",dictOption = "N:关闭,Y:开启")
    private String repositoryCheck;
    @FieldMeta(name="account_day",type= FieldType.STRING,length=10,defaultValue = "15",description="账期结束日",dictOption = "05:次月5号,10:次月10号,15:次月15号,20:次月20号,25:次月25号")
    private String accountDay;

    @FieldMeta(name="logout_date",type= FieldType.DATE,description="注销日期")
    private Date logoutDate;

    public Date getLogoutDate() {
        return logoutDate;
    }

    public void setLogoutDate(Date logoutDate) {
        this.logoutDate = logoutDate;
    }

    public String getRepositoryCheck() {
        return repositoryCheck;
    }

    public void setRepositoryCheck(String repositoryCheck) {
        this.repositoryCheck = repositoryCheck;
    }

    public Date getLevelEndDate() {
        return levelEndDate;
    }

    public void setLevelEndDate(Date levelEndDate) {
        this.levelEndDate = levelEndDate;
    }

    public String getAccountDay() {
        return accountDay;
    }

    public void setAccountDay(String accountDay) {
        this.accountDay = accountDay;
    }

    public String getCreateUserOid() {
        return createUserOid;
    }

    public void setCreateUserOid(String createUserOid) {
        this.createUserOid = createUserOid;
    }

    public LevelInfo getLevel() {
        return level;
    }

    public void setLevel(LevelInfo level) {
        this.level = level;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public StoreInfo getCacheModel(String key) throws Exception {
        return ModelQueryList.getModel(StoreInfo.class,key,"*","level.*","parent.name");
    }
}
